package com.xd.core.system.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 
 * </p>
 *
 * @author ZX
 * @since 2025-03-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="ProvincesInfo对象", description="")
public class ProvincesInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键自增")
    private Integer id;

    private String cityName;

    @ApiModelProperty(value = "父类id")
    private Integer parentId;

    @ApiModelProperty(value = "简称")
    private String shortName;

    private Integer depth;

    private String cityCode;

    private String zipCode;

    @ApiModelProperty(value = "全称")
    private String mergerName;

    private String longitude;

    private String latitude;

    private String pinyin;

    @TableField(exist = false)
    @ApiModelProperty(value = "子级")
    private List<ProvincesInfo> provinceChild;

    public void addChild(ProvincesInfo child) {
        if (this.provinceChild == null)
            this.provinceChild = new ArrayList<>();
        this.provinceChild.add(child);
    }
}
